import request from '@/utils/request'

/**
 * 获取资源树
 */
export function resourceTree(data) {
  return request({
    url: '/middleuser/resource/tree',
    method: 'post',
    data
  })
}

/**
 * 根据id查询
 * @param data
 */
export function getResource(data) {
  return request({
    url: `/middleuser/resource/get`,
    method: 'post',
    data
  })
}

/**
 * 校验资源代码是否存在
 * @param data
 */
export function checkResourceCode(data) {
  return request({
    url: `/middleuser/resource/check`,
    method: 'post',
    data
  })
}

/**
 * 保存
 * @param data
 */
export function saveResource(data) {
  return request({
    url: '/middleuser/resource/save',
    method: 'post',
    data
  })
}

/**
 * 更新
 * @param data
 */
export function updateResource(data) {
  return request({
    url: '/middleuser/resource/update',
    method: 'post',
    data
  })
}

/**
 * 删除
 * @param data
 */
export function delResource(data) {
  return request({
    url: '/middleuser/resource/del',
    method: 'post',
    data
  })
}
